package com.noble.glamour.ui.user.my.diamond;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.noble.glamour.R;
import com.noble.glamour.bean.config.base.Goods;
import com.noble.glamour.module.logic.application.ModuleMgr;
import com.noble.library.base.BaseActivity;
import com.noble.glamour.module.util.UIShow;
import com.noble.glamour.ui.user.my.view.DividerItemDecoration;

import java.util.List;

/**
 * 我的钻石页面
 */
public class MyDiamondsAct extends BaseActivity implements View.OnClickListener {
    private TextView tvDiamondSum;
    private RecyclerView rlvList;
    private MyDiamondAdapter mMyDiamondAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.f1_wode_my_diamonds_act);
        initView();
    }

    private void initView() {
        setBackView(getString(R.string.my_diamonds_explain));
        findViewById(R.id.diamond_declare).setOnClickListener(this);
        tvDiamondSum = (TextView) findViewById(R.id.wode_diamond_txv_sum);
        rlvList = (RecyclerView) findViewById(R.id.recycler_view);
        rlvList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        rlvList.addItemDecoration(new DividerItemDecoration(this,
                DividerItemDecoration.VERTICAL_LIST, R.drawable.p1_decoration_px1));
        initData();
    }

    private void initData() {
        tvDiamondSum.setText(ModuleMgr.getCenterMgr().getMyInfo().getDiamand() + "");
        mMyDiamondAdapter = new MyDiamondAdapter(this);
        List<Goods> dataList = ModuleMgr.getCommonMgr().getCommonConfig().getPay().getDiamondList();

        rlvList.setAdapter(mMyDiamondAdapter);
        mMyDiamondAdapter.setList(dataList);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.diamond_declare:
                UIShow.showMyDiamondsExplainAct(this);
                break;
        }
    }
}